package com.bestdata.forward.initconfig;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @author chizhenyu
 * @date 2021年6月9日09:25:37
 * @description 定时更新token
 */
@Service
@Lazy(false)
@EnableScheduling
public class TimerTaskInitToken {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Scheduled(cron = "50 0 */1 * * ?")
    public void executeInternal() {
        try {
            InitConfigService.initGlobalToken();
            logger.info("定时器执行更新token完成");
        }catch (Exception e ){
            logger.error("定时器执行更新token失败！"+e);
            e.printStackTrace();
        }

    }
}
